/** form **********************************************************************/
export class UserForm {
    public userId!: string;
    public nickName!: string;
    public mobile!: string;
    public email!: string;
    public statusDictId!: string;
    public userOrgList: UserOrgForm[] = [];

    public static rules = {
        nickName: [{ required: true, message: '请输入用户昵称', trigger: 'blur' }],
        statusDictId: [{ required: true, message: '请选择用户状态', trigger: 'blur' }],
        userOrgList: [{ required: true, message: '请选择单位', trigger: 'blur' }],
        orgId: [{ required: true, message: '请选择单位', trigger: 'blur' }],
    };
}

export class UserOrgForm {
    public orgId!: string;
    public roleIdList: string[] = [];
}

/** query *********************************************************************/
export class UserQuery {
    public nickName!: string;
    public orgId!: string;
    public statusDictId!: string;
}

/** dto ***********************************************************************/
export class UserListDTO {
    public userId!: string;
    public nickName!: string;
    public orgId!: string;
    public orgName!: string;
    public mobile!: string;
    public email!: string;
    public statusDictId!: string;
    public statusDictName!: string;

    public static columns = [
        {
            title: '昵称',
            dataIndex: 'nickName',
        },
        {
            title: '单位',
            dataIndex: 'orgName',
            width: 300,
        },
        {
            title: '手机号码',
            dataIndex: 'mobile',
            align: 'center',
            width: 200,
        },
        {
            title: '邮箱',
            dataIndex: 'email',
            width: 200,
        },
        {
            title: '状态',
            dataIndex: 'statusDictName',
            align: 'center',
            width: 120,
        },
        {
            title: '操作',
            dataIndex: 'action',
            width: 200,
            fixed: 'right',
        },
    ];
}

export class UserDTO {
    public userId!: string;
    public nickName!: string;
    public mobile!: string;
    public email!: string;
    public statusDictId!: string;
    public statusDictName!: string;
    public userOrgList: UserOrgDTO[] = [];
}

export class UserOrgDTO {
    public orgId!: string;
    public orgName!: string;
    public roleIdList: string[] = [];
}

export class UserDetailDTO {
    public userId!: string;
    public nickName!: string;
    public orgId!: string;
    public orgName!: string;
    public permissionList: string[] = [];
    public orgList: UserOrgDTO[] = [];
}
